import 'package:elephant_fish/page/index_shop_beautiful_page.dart';
import 'package:elephant_fish/page/index_title_page.dart';
import 'package:elephant_fish/util/size_util.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

import 'index_rank_home_page.dart';

class IndexShopPage extends StatefulWidget {
  const IndexShopPage({Key key}) : super(key: key);

  @override
  _IndexShopPageState createState() => _IndexShopPageState();
}

class _TabData {
  final Widget tab;
  final Widget body;

  _TabData({this.tab, this.body});
}

final _tabDataList = <_TabData>[
  _TabData(
      tab: Text('称号'),
      body: IndexTitlePage(

      )),
  _TabData(
      tab: Text('靓号'),
      body: IndexShopBeautifulPage(
      )),
];
class _IndexShopPageState extends State<IndexShopPage> {
  final tabBarList = _tabDataList.map((item) => item.tab).toList();
  final tabBarViewList = _tabDataList.map((item) => item.body).toList();
  @override
  Widget build(BuildContext context) {
    return DefaultTabController(length: tabBarList.length,
      child:  Scaffold(
        backgroundColor: Color(0xff1b1b1b),
        appBar: AppBar(
          automaticallyImplyLeading: false,
          backgroundColor: Color(0xff1b1b1b),
          centerTitle: true,
          title: Text('商城',style: TextStyle(fontSize: SizeUtil.px(32),color: Color(0xfff3f3f3)),),
          actions: [
            Align(
              alignment: Alignment.centerRight,
              child: Padding(
                padding: EdgeInsets.only(right: SizeUtil.px(30)),
                child: Text('办理规则',style: TextStyle(fontSize: SizeUtil.px(30),color: Color(
                    0xfff3f3f3)),),
              ),
            )
          ],
          bottom: TabBar(
            // isScrollable: true, //可滚动
            indicatorColor: Color(0xffff215d), //指示器的颜色
            indicator: const BoxDecoration(),
            labelColor: Color(0xffff215d), //选中文字颜色
            unselectedLabelColor: Color(0xfff3f3f3), //为选中文字颜色
            isScrollable: false,
            unselectedLabelStyle: TextStyle(
              fontSize: SizeUtil.px(30),
            ),
            labelStyle: TextStyle(
              fontSize: SizeUtil.px(40),
            ),
            // indicatorSize: TabBarIndicatorSize.label, //指示器与文字等宽
            tabs: tabBarList,
          ),
        ),
        body: TabBarView(
          children: tabBarViewList,
        ),
      ));
  }
}
